
<!-- 变更主体 -->
<script lang="ts" setup>
import { ref } from 'vue'
import utils from '@/utils/utils'
const defaultTheme = ref(localStorage.getItem('--el-color-primary') || '#409eff')
utils.setTheme('--el-color-primary', defaultTheme.value) //初始化主题色

const colorSet = (val: any): void => {
    //动态修改主题色
    utils.setTheme('--el-color-primary', val)
    localStorage.setItem('--el-color-primary', val)
}
</script>

<template>
    <div class="demo-color-block">
        <span class="demonstration" style="margin-right: 10px;">自定义主题色</span>
        <el-color-picker v-model="defaultTheme" @change="colorSet" />
    </div>
</template>
  
<style lang="scss">

</style>